package client.connect;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

import client.Client;

public class FrameConnect extends JFrame  {
	
	private PanelConnection panelConnection;
	private PanelUsers panelUsers;
	private PanelButton panelButton;
	
	public Client client;

	public FrameConnect() {
		setTitle("Connection to server");
		setLocation(50, 50);
		setBackground(Color.BLACK);
		setMinimumSize(new Dimension(400, 300));
		setLayout(new BorderLayout());
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		
		panelConnection = new PanelConnection(this);
		panelUsers = new PanelUsers(this);
		panelButton = new PanelButton(this);
		
		add(panelConnection, BorderLayout.NORTH);
		add(panelUsers, BorderLayout.CENTER);
		add(panelButton, BorderLayout.SOUTH);
		
		pack();
		setVisible(true);
	}
	
	public void updateUserList(List <String>  users) {
		panelUsers.showUsers(users);
	}
	
	public ArrayList<String> getSelectedMember()
	{
		return panelUsers.getMemberSelected();
	}

	
}
